//多次调用的接口
import http from '@/request.js';

//获取环境状态
export const getSiteInfoID  = (data) => {
	return http.post(
		{
			url:'/siteLine/getSiteInfoID',
			param:data,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}

//登录
export const login  = (data) => {
	return http.post(
		{
			url:'/auth/login2',
			param:data,
			tt:true,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}


//获取图片验证码
export const loginCode  = (data) => {
	return http.post(
		{
			url:'/auth/getpiccheckinfo',
			param:data,
			tt:true,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}

//校验
export const checkTnCode  = (data) => {
	return http.post(
		{
			url:'/auth/piccheckinfo',
			param:data,
			tt:true,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}


//查询设备状态--传参：站名、设备类型、状态  返回：在离线数量、设备列表
export const devices  = (data) => {
	return http.post(
		{
			url:'/sysProject/getTeminal',
			param:data,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}

//获取订单列表
export const orders  = (data) => {
	return http.get(
		{
			url:'/sysProject/getSysProjectSel',
			param:data,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}

//获取设备类型  数据字典
export const getTreeJsonByCode  = (data) => {
	return http.post(
		{
			url:'/sysDictionary/getTreeJsonByCode',
			param:data,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}

//取得数据字典下级树状结构
export const getTreeJsonChilds = (data) => {
	return http.post(
		{
			url:'/sysDictionary/getTreeChildsJson',
			param:data,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}
//获取终端信息
export const device_info_now  = (data) => {
	return http.get(
		{
			url:'/siteInfo/getSiteInfoById/'+data,
		}
	)
}

//获取站点 by 经纬度
export const getNearSites  = (data) => {
	return http.get(
		{
			url:'/siteInfo/getNearSites',
			param:data
		}
	)
}

//获取站点 by 名称
export const getSitesbyName  = (data) => {
	return http.get(
		{
			url:'/siteInfo/getSitesbyName',
			param:data
		}
	)
}

//获取环境状态
export const control_state  = (data) => {
	return http.post(
		{
			url:'/sysProject/getTemp',
			param:data,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}

//设备信息编辑
export const device_info  = (data) => {
	return http.put(
		{
			url:'/siteInfo/updateSiteInfo',
			param:data
		}
	)
}

//获取个人信息
export const user_info  = (data) => {
	return http.get(
		{
			url:'/auth/profile',
			param:data
		}
	)
}

//修改密码
export const pwd_change  = (data) => {
	return http.post(
		{
			url:'/auth/updatePassword',
			param:data
		}
	)
}

//意见反馈
export const feedback  = (data) => {
	return http.post(
		{
			url:'/appSuggestion/addAppSuggestion',
			param:data
		}
	)
}

//站点任务列表--分頁
export const findSiteTask  = (data) => {
	return http.post_page(
		{
			url:'/siteInfo/findSiteTaskInfoPage',
			param:data
		}
	)
}

//任务新增
export const addAppTask  = (data) => {
	return http.post(
		{
			url:'/appTask/addAppTask',
			param:data
		}
	)
}

//维修记录新增
export const addAppMaintenance  = (data) => {
	return http.post(
		{
			url:'/appMaintenance/addAppMaintenance',
			param:data
		}
	)
}
//代办任务单个获取
export const getAppTaskById  = (data) => {
	return http.get(
		{
			url:'/appTask/getAppTaskById/'+data,
		}
	)
}
//维修记录单个获取
export const getAppMaintenanceById  = (data) => {
	return http.get(
		{
			url:'/appMaintenance/getAppMaintenanceById/'+data,
		}
	)
}

//维修记录修改
export const updateAppMaintenance  = (data) => {
	return http.put(
		{
			url:'/appMaintenance/updateAppMaintenance',
			param:data
		}
	)
}

//iplog获取-站点精准查询
// export const iplog_one  = (data) => {
// 	return http.post(
// 		{
// 			url:'/sysProject/getTerminalStateHistoryInfo',
// 			param:data
// 		}
// 	)
// }

//iplog获取
export const iplog  = (data) => {
	return http.post(
		{
			url:'/sysProject/getTerminalStateHistoryInfo',
			param:data,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}

//集中控制器状态查询
export const getControllerSettingInfo  = (data) => {
	return http.post(
		{
			url:'/sysProject/getControllerSettingInfo',
			param:data,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}

//集中控制器状态设置
export const updateControllerSettingInfo  = (data) => {
	return http.post(
		{
			url:'/sysProject/updateControllerSettingInfo',
			param:data
		}
	)
}

//獲取所有用戶
export const findSysUserAll  = (data) => {
	return http.post(
		{
			url:'/sysUser/findSysUserAll',
			param:data
		}
	)
}


//終端綁定
export const setTerminalSN  = (data) => {
	return http.post(
		{
			url:'/siteLine/setTerminalSN',
			param:data,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}

//終端綁定
export const setTerminalV4Code  = (data) => {
	return http.post(
		{
			url:'/siteLine/setTerminalV4Code',
			param:data,
			header:{
				"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
			}
		}
	)
}

//獲取線路列表
export const lines = (data) => {
	return http.post({
		url: '/siteLine/lines',
		param: data,
		header:{
			"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
		}
	})
}

//一个站点的线路
export const siteline = (data) => {
	return http.get({
		url: '/siteLine/siteline/'+data
	})
}

//线路更新
export const line = (data) => {
	return http.put({
		url: '/siteLine/line',
		param: data,
		header:{
			"Content-Type": "application/x-www-form-urlencoded ;charset=utf-8"
		}
	})
}

//终端配置
export const site = (data) => {
	return http.post({
		url: '/siteLine/updateSiteInfo',
		param: data
	})
}


/////////////////////張榮欣///////////////////////////////////
//消息通知--分頁
export const mssageList  = (data) => {
	return http.post_page(
		{
			url:'/appNotice/findAppNoticePage',
			param:data
		}
	)
}

//工具库--分頁
export const toolList  = (data) => {
	return http.post_page(
		{
			url:'/toolOperationManual/findToolOperationManualPage',
			param:data
		}
	)
}

//维修知识库--分頁
export const repairList  = (data) => {
	return http.post_page(
		{
			url:'/toolCase/findToolCasePage',
			param:data
		}
	)
}

//代办任务分页--分頁
export const findAppUndoTaskPage  = (data) => {
	return http.post_page(
		{
			url:'/appTask/findAppUndoTaskPage',
			param:data
		}
	)
}

//预警信息分页--分頁
export const findAppSysWarning  = (data) => {
	return http.post_page(
		{
			url:'/sysWarning/findAppSysWarningPage',
			param:data
		}
	)
}

//维保记录分页--分頁
export const findAppMaintenanceDeatil  = (data) => {
	return http.post_page(
		{
			url:'/appMaintenanceDeatil/findAppMaintenanceDeatilPage',
			param:data
		}
	)
}

//维保新增
export const addMaintenance  = (data) => {
	return http.post(
		{
			url:'/appMaintenanceDeatil/addAppMaintenanceDeatil',
			param:data
		}
	)
}

//获取消息通知
export const notice  = (data) => {
	return http.post(
		{
			url:'/appNotice/findAppNoticePage/',
			param:data
		}
	)
}





///////////////////////////////////沒用的////////////////////////////////////


//文件上传 微信小程序只支持单个文件上传
// export const file_upload  = (data) => {
// 	return http.post(
// 		{
// 			url:'/file/ubatchUpload',
// 			param:data,
// 			tt:true
// 		}
// 	)
// }
